'''MainWindow'''
import sys

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtCore import QTimer
from PyQt5.QtGui import QImage, QPixmap, QKeyEvent
from PyQt5.QtWidgets import QMessageBox,QInputDialog
from PyQt5.QtCore import Qt
from fatigue_algo.scrfd import scrfd
from fatigue_algo.landmark_mbv2.onnx.detector import Detector

from GUI.login import Ui_Login_MainWindow

'''疲劳参数配置窗口'''
class FatigueParamWindow(QtWidgets.QMainWindow, Ui_Login_MainWindow):

    def __init__(self,cfg, preParamWindow = None, nextParamWindow = None):
        super(FatigueParamWindow,self).__init__()
        self.cfg = cfg
        self.setupUi(self)  # 初始化时创建窗口对象，但点击next时再显示
        self.init()  #按钮事件绑定
        self.preParamWindow = preParamWindow  # 上一个参数子页面
        self.nextParamWindow = nextParamWindow  # 下一个参数子页面

    #为按钮绑定enter槽函数
    def init(self):
        self.pushButton.clicked.connect(lambda : self.next())

    # 设置"上一步"按钮可见
    def set_preButton_Visible(self):
        self.pushButton_2.setVisible(True)
        self.pushButton_2.clicked.connect(lambda: self.pre())

    #参数配置
    def paramSet(self):
        # 疲劳配置信息包括：
        pass

    #跳转至下一个参数配置窗口
    def next(self):
        self.nextParamWindow = self.cfg
        self.nextParamWindow.setupUi(self.nextParamWindow)
